// drawCashrecord.js
var app = getApp()
Page({

    /**
     * 页面的初始数据
     */
    data: {
        pageIndex: 1
    },

    /**
     * 生命周期函数--监听页面加载
     */
    onLoad: function(options) {
        var that = this;
        wx.request({
            url: app.data.baseUrl + '/AibraUsb/withdraw/list.do',
            data: {
                openId: app.globalData.openid,
                pageIndex: that.data.pageIndex
            },
            success: function(res) {
                that.setData({
                    withdrawList: res.data.withdrawList,

                })
            }
        })
    },

    /**
     * 生命周期函数--监听页面初次渲染完成
     */
    onReady: function() {

    },

    /**
     * 生命周期函数--监听页面显示
     */
    onShow: function() {

    },

    /**
     * 生命周期函数--监听页面隐藏
     */
    onHide: function() {

    },

    /**
     * 生命周期函数--监听页面卸载
     */
    onUnload: function() {

    },

    /**
     * 页面相关事件处理函数--监听用户下拉动作
     */
    onPullDownRefresh: function() {

    },

    /**
     * 页面上拉触底事件的处理函数
     */
    onReachBottom: function() {

    },

    /**
     * 用户点击右上角分享
     */
    onShareAppMessage: function() {

    },
    scrolltolower: function() {
        // let count = 1;
        var that = this
        var pageIndex = that.data.pageIndex;
        wx.request({
                url: app.data.baseUrl + '/AibraUsb/withdraw/list.do',
                data: {
                    openId: app.globalData.openid,
                    pageIndex: pageIndex
                },
                success: function(res) {

                    var withdrawList1 = res.data.withdrawList;
                    var withdrawList2 = that.data.withdrawList;

                    withdrawList2 = withdrawList2.concat(withdrawList1)
                    pageIndex = ++pageIndex;
                    that.setData({
                        withdrawList: withdrawList2,
                        pageIndex: pageIndex
                    })
                },
                fail: function() {
                    console.log("失败")
                }
            })
            // that.data.searchPageNum++;
            // 我们用total和count来控制分页，total代表已请求数据的总数，count代表每次请求的个数。
    }
})